package com.jpm.jrogue.factories
{
	import starling.display.Image;
	import starling.textures.Texture;
	import starling.textures.TextureAtlas;
	import starling.utils.AssetManager;
	
	/**
	 * ...
	 * @author Jonboy
	 */
	public class ImageFactory
	{
		
		[Embed(source="../assets/rogueAssets.png")]
		public static const AssetsTexture:Class;
		
		[Embed(source="../assets/rogueAssets.xml",mimeType="application/octet-stream")]
		public static const AssetsXML:Class;
		
		private static var assetManager:AssetManager;
		
		public static function init():void
		{
			assetManager = new AssetManager();
			assetManager.addTextureAtlas("atlas", new TextureAtlas(Texture.fromBitmap(new AssetsTexture()), XML(new AssetsXML())));
		}
		
		public static function getImage(name:String):Image
		{
			var image:Image = new Image(assetManager.getTexture(name));
			image.width = 108;
			image.height = 108;
			return image;
		}
		
		public static function getTexture(name:String):Texture
		{
			return assetManager.getTexture(name);
		}
	
	}
}